<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link href="/assets/css/text.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/main.css" rel="stylesheet" type="text/css">
    <link href="/assets/css/content.css" rel="stylesheet" type="text/css">
    <script language="JavaScript" type="text/JavaScript">
    </script>
    <style>
        #title {
            width: 92%;
            border: 0px;
            margin-bottom: 10px;
        }

        #title td {
            text-align: center;
            height: 20px;
            line-height: 150%
        }

        #title div {
            background-image: url(/assets/img/dot_02.gif);
            background-position: left top;
            background-repeat: no-repeat;
            margin: 0 auto;
            padding-left: 20px;
            text-align: left;
            width: 10%;
            font-size: 15px;
            font-weight: bold;
            color: #CC0000;
            letter-spacing: 2px;
        }

        tr.change:hover {
            background-color: #dd3c10;
        }
    </style>

</head>
<body>
<table cellspacing="0" cellpadding="0" id="title" align="center">
    <tbody>
    <tr>
        <td nowrap="nowrap">
            <div>成品入库</div>
        </td>
    </tr>
    </tbody>
</table>

<table cellspacing="0" cellpadding="0" class="subtitle" align="center">
    <tbody>
    <tr>
        <td class="subtitle">成品入库说明</td>
        <td id="rightbg">&nbsp;</td>
    </tr>
    </tbody>
</table>
<table cellpadding="0" cellspacing="0" class="explain_tab" align="center">
    <tbody>
    <tr>
        <td class="explain" colspan="14">
            <p align="left">${msg}</p>
        </td>
    </tr>
    </tbody>
</table>
<br><br>
<table cellpadding="0" cellspacing="0" class="subtitle" align="center">
    <tbody>
    <tr align="center">
    <tr>
        <td colspan="3" class="subtitle">查询产品编码</td>
        <td id="rightbg">&nbsp;</td>
    </tr>
</table>
<table cellpadding="0" cellspacing="0" class="datalist" align="center">
    <tr>
        <th colspan="1">编号</th>
        <th colspan="1">名称</th>
        <th colspan="1">规格</th>
        <th colspan="1">操作</th>
    </tr>
    <form action="/gethname8.do" method="post">
        <tr>
            <td align="center" colspan="1"></td>
            <td align="center" colspan="1"><input name="h_name" type="text" value=""></td>
            <td align="center" colspan="1"><input name="h_size" type="text" value=""></td>
            <td align="center" colspan="1"><input type="submit" value="查询"/></td>
        </tr>
    </form>
    <c:if test="${not empty query}">
        <c:forEach items="${query}" var="q" varStatus="status">
            <script>
                function add${status.count}() {
                    document.getElementById("h_no").value = document.form${status.count}.no.value;
                    document.getElementById("h_name").value = document.form${status.count}.name.value;
                    document.getElementById("h_size").value = document.form${status.count}.size.value;
                }
            </script>
            <form name="form${status.count}">
                <tr class="change">
                    <td align="center" colspan="1"><input type="hidden" id="no${status.count}" name="no"
                                                          value="${q.h_no}"/> ${q.h_no}</td>
                    <td align="center" colspan="1"><input type="hidden" id="name${status.count}" name="name"
                                                          value="${q.h_name}"/>${q.h_name}</td>
                    <td align="center" colspan="1"><input type="hidden" id="size${status.count}" name="size"
                                                          value="${q.h_size}"/>${q.h_size}</td>
                    <td align="center" colspan="1"><input type="button" value="添加" onclick="add${status.count}()"/></td>
                </tr>
            </form>
        </c:forEach>
    </c:if>
    </tbody>
</table>
<br>
<table cellpadding="0" cellspacing="0" class="subtitle">
    <tbody>
    <form action="/finishproductupload.do" method="post">
        <tr align="center">
            <td colspan="14" class="subtitle"><input type="submit" value="上传仓库审批"/></td>
            <td id="rightbg">&nbsp;</td>
        </tr>
    </form>
    </tbody>
</table>
<table cellpadding="0" cellspacing="0" class="datalist">
    <% SimpleDateFormat df2 = new SimpleDateFormat("yyyyMMdd");
        Date now2 = new Date();%>
    <tbody>
    <form action="/finishproductInsert.do" method="post">
        <input type="hidden" name="status" value="0">
        <tr>
            <td align="right" colspan="2"><input type="submit" class="button" value="保存"/></td>
        </tr>
        <tr>
            <th width="20%"></th>
            <td height="25" align="center">
            </td>
        </tr>
        <tr>
            <th>铸件/配件编码</th>
            <td height="25" align="center"><input name="h_no" id="h_no" type="text" value=""></td>
        </tr>
        <tr>
            <th>铸件/配件名称</th>
            <td height="25" align="center"><input name="h_name" id="h_name" type="text" value=""></td>
        </tr>
        <tr>
            <th align="center">规格</th>
            <td height="25" align="center"><input name="h_size" id="h_size" type="text" value=""></td>
        </tr>
        <tr>
            <th align="center">数量</th>
            <td height="25" align="center"><input name="h_num" id="h_num" type="number" value=""></td>
        </tr>
        <tr>
            <th align="center">商标</th>
            <td height="25" align="center">
                <jsp:include page="R.jsp"/>
            </td>
        </tr>
        <tr>
            <th align="center">压力</th>
            <td height="25" align="center">
                <jsp:include page="PN.jsp"/>
            </td>
        </tr>
        <tr>
            <th align="center">入库日期</th>
            <td height="25" align="center"><input type="text" name="h_date" value="<%=df2.format(now2)%>"></td>
        </tr>
        <tr>
            <th align="center">入库人员</th>
            <td height="25" align="center"><input type="text" name="h_people" value=""></td>
        </tr>
        <tr>
            <th align="center">凭条编号</th>
            <td height="25" align="center"><input type="text" name="h_ticketno"
                                                  value="PSL<%=df2.format(now2)%>" readonly></td>
        </tr>
        <tr>
            <th align="center">状态</th>
            <td height="25" align="center"><input type="text" value="" readonly></td>
        </tr>
    </form>
</table>
<br>
<table cellpadding="0" cellspacing="0" class="datalist" align="center">
    <tr>
        <th align="center">操作</th>
        <th align="center">序号</th>
        <th align="center">铸件/配件编码</th>
        <th align="center">铸件/配件名称</th>
        <th align="center">数量</th>
        <th align="center">入库时间</th>
        <th align="center">入库人员</th>
        <th align="center">凭条编号</th>
        <th align="center">状态</th>
    </tr>
    <c:forEach items="${finish}" var="p">
        <c:set var="h_id" value="${p.h_id}"/>
        <c:set var="h_no" value="${p.h_no}"/>
        <c:set var="h_name" value="${p.h_name}"/>
        <c:set var="h_num" value="${p.h_num}"/>
        <c:set var="h_date" value="${p.h_date}"/>
        <c:set var="h_people" value="${p.h_people}"/>
        <c:set var="h_ticketno" value="${p.h_ticketno}"/>
        <tr>
            <td height="25" align="center">
                <a href="/procfpsdetail.do?h_id=${fn:escapeXml(h_id)}"><img src="/assets/img/view.gif"></a>
                <a href="/delfinishproduct.do?h_id=${fn:escapeXml(h_id)}"><img src="/assets/img/icodelete.gif"></a>
            </td>
            <td height="25" align="center">${fn:escapeXml(h_id)}</td>
            <td height="25" align="center">${fn:escapeXml(p.h_no)}</td>
            <td height="25" align="center">${fn:escapeXml(h_name)}</td>
            <td height="25" align="center">${fn:escapeXml(h_num)}</td>
            <td height="25" align="center">${fn:escapeXml(h_date)}</td>
            <td height="25" align="center">${fn:escapeXml(h_people)}</td>
            <td height="25" align="center">${fn:escapeXml(h_ticketno)}</td>
            <td height="25" align="center">
                <c:if test="${p.status==0}">
                    待审核
                </c:if>
            </td>
        </tr>
    </c:forEach>
</table>
</body>
</html>